var initArg, debugWin, debugOut, isOpera;
function openDebugWin(arg){
	//if(frames.debugWin)debugWin.close();
	if (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)){
		//alert(navigator.userAgent +':'+/opera/i.test(navigator.userAgent));
		//reinit = function(){init(arg)}
		initArg = arg;
		debugWin = window.open('debugWin.php', 'debugWindow',	'left=0,top=0,width=400,height=400,scrollbars=yes');
		return;
	}
	 (/opera/i.test(navigator.userAgent)) ? isOpera = 1: isOpera = 0;
	init(arg)
}
function debug(m){
	//return;
	if(typeof(dump)!='undefined'){
		dump(m+'\n')
		return
		}
	if(isOpera)
		opera.postError(m);
	if(!debugWin || !debugWin.dOut)return;
	//debugWin.document.write(m+'<br>');
	debugWin.dOut.value +=(m+'\n');
	//debugWin.scrollTo(0, debugWin.document.body.scrollHeight)
	debugWin.focus()	
	} 
function dumpObject(o, deep){ 
	deep ? deep=true : deep = false
	debug('dump:'+o+' recursive:'+deep); 
	for(e in o){
		try{
			debug(e+'->'+o[e] + ':'+typeof(o[e]));
			if(deep && typeof(o[e]) == 'object') dumpObject(o[e], 1);
		}
		catch(ex){
			debug(e+ ' exception:'+ex)
		}
	}
}
function dumpArray(a){
	debug(a+' len:'+a.length+' typeof:'+typeof(a));
	for(var i=0;i<a.length;i++)debug(i+'->'+a[i]);
}
function dumpLayout(el){
	debug('el:' + el.id +':'+el.nodeName)
	if(el.style.bottom)debug('bottom:'+el.style.bottom)
	debug('top:'+el.offsetTop)
	debug('left:'+el.offsetLeft)
	debug('width:'+el.offsetWidth)
	debug('height:'+el.offsetHeight)
	if(el.style.visibility)debug('visibility:'+el.style.visibility)
	if(el.style.zIndex)debug('ZIndex:'+el.style.zIndex)
}